
import java.util.ArrayList;
import java.util.HashMap;

/*
 * To change this template, choose Tools | Templates and open the template in
 * the editor.
 */
/**
 *
 * @author Paolo
 */
public class Teste {

    public static void main(String args[]) throws InterruptedException {
        HashMap<String, ComunicationUniCast> pc = new HashMap<String, ComunicationUniCast>();
        ArrayList<String> nomeDosProcessos = new ArrayList<String>();
        Distributor d;
        Stub sb;

        nomeDosProcessos.add("nodo");
        nomeDosProcessos.add("1");
        nomeDosProcessos.add("2");
        nomeDosProcessos.add("prox");

        pc.put("nodo", new ComunicationUniCast(null, 8000, "localhost"));
        pc.put("1", new ComunicationUniCast(null, 8001, "localhost"));
        pc.put("2", new ComunicationUniCast(null, 8002, "localhost"));
        pc.put("prox", new ComunicationUniCast(null, 8003, "localhost"));

        d = new Distributor(null, 1, 8000, pc, nomeDosProcessos);
        new Thread(d).start();
        sb = new Stub(8001,8002,8003,8000,1);
        d.passar();
        d.passar();
        System.out.println("Teste: Clicar de novo");
        new Thread(sb).start();

        Thread.sleep(1000);
        d.passar();
    }
}
